
//TODO a(60)
function a60(module, exports, a) {
    function i(e, t) {
        return e.clientY - t.clientY
    }

    var s = a(3), r = a(18), n = function (e, t) {
        this.node = e, this.inDoubleTap = !1, this.isOneFingerGesture = !1, this.doubleTapTimer = null, this.longTapTimer = null, t = t || {}, this.startTouch = {
            x: 0,
            y: 0
        }, this.currentTouch = {x: 0, y: 0}, this.previousTouch = {x: 0, y: 0}, this.currentDelta = {
            x: 0,
            y: 0
        }, this.currentStartDelta = {
            x: 0,
            y: 0
        }, this.eventNode = t.isTargetNode ? this.node : document, this.touchStartFn = s.bind(this.touchStart, this), this.touchMoveFn = s.bind(this.touchMove, this), this.touchEndFn = s.bind(this.touchEnd, this), t.isPC ? this.node.addEventListener("mousedown", this.touchStartFn, !1) : this.node.addEventListener("touchstart", this.touchStartFn, !1)
    };
    n.prototype = {
        touchStart: function (e) {
            var t = this;
            if (this.reset(), e.touches) {
                if (!e.touches.length || this.isCurrentlyTouching)return !1;
                if (this.isCurrentlyTouching = !0, this.isOneFingerGesture = 1 == e.touches.length, 1 == e.touches.length) this.startTouch.x = this.currentTouch.x = e.touches[0].clientX, this.startTouch.y = this.currentTouch.y = e.touches[0].clientY; else if (e.touches.length > 1) {
                    for (var a = [], s = 0, r = e.touches.length; s < r; s++)a.push(e.touches[s]);
                    a.sort(i);
                    var r = a.length - 1;
                    this.startTouch.x = this.currentTouch.x = a[r].clientX, this.startTouch.y = this.currentTouch.y = a[r].clientY
                }
                this.eventNode.addEventListener("touchmove", this.touchMoveFn, !1), this.eventNode.addEventListener("touchend", this.touchEndFn, !1)
            } else this.startTouch.x = this.currentTouch.x = e.pageX, this.startTouch.y = this.currentTouch.y = e.pageY, this.eventNode.addEventListener("mousemove", this.touchMoveFn, !1), this.eventNode.addEventListener("mouseup", this.touchEndFn, !1);
            this.target = e.target, this.currentTarget = e.currentTarget, this.hitTarget = document.elementFromPoint ? document.elementFromPoint(this.startTouch.x, this.startTouch.y) : null, this.inDoubleTap ? (this.trigger("doubleTouch", this), clearTimeout(t.doubleTapTimer), this.inDoubleTap = !1) : (this.inDoubleTap = !0, this.doubleTapTimer = setTimeout(function () {
                    t.inDoubleTap = !1
                }, 500)), this.longTapTimer = setTimeout(function () {
                t.trigger("longTouch", t)
            }, 1e3), this.trigger("touchstart", this, e)
        }, touchMove: function (e) {
            if (this.previousTouch.x = this.currentTouch.x, this.previousTouch.y = this.currentTouch.y, e.touches) {
                if (!e.touches.length || !this.isOneFingerGesture)return;
                if (e.touches.length > 1)return void(this.isOneFingerGesture = !1);
                this.currentTouch.x = e.touches[0].clientX, this.currentTouch.y = e.touches[0].clientY
            } else this.currentTouch.x = e.pageX, this.currentTouch.y = e.pageY;
            this.currentDelta.x = this.currentTouch.x - this.previousTouch.x, this.currentDelta.y = this.currentTouch.y - this.previousTouch.y, this.currentStartDelta.x = this.currentTouch.x - this.startTouch.x, this.currentStartDelta.y = this.currentTouch.y - this.startTouch.y, this.target = e.target, this.currentTarget = e.currentTarget, this.trigger("touchmove", this, e), this.longTapTimer && clearTimeout(this.longTapTimer)
        }, touchEnd: function (e) {
            if (e.touches) {
                if (e.targetTouches.length)return;
                this.eventNode.removeEventListener("touchmove", this.touchMoveFn, !1), this.eventNode.removeEventListener("touchend", this.touchEndFn, !1)
            } else this.eventNode.removeEventListener("mousemove", this.touchMoveFn, !1), this.eventNode.removeEventListener("mouseup", this.touchEndFn, !1);
            this.isCurrentlyTouching = !1, this.longTapTimer && clearTimeout(this.longTapTimer), this.trigger("touchend", this, e)
        }, reset: function () {
            this.startTouch = {x: 0, y: 0}, this.currentTouch = {x: 0, y: 0}, this.previousTouch = {
                x: 0,
                y: 0
            }, this.currentDelta = {x: 0, y: 0}, this.currentStartDelta = {x: 0, y: 0}
        }
    }, s.merge(n.prototype, r), module.exports = n
}
